﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using monadsphere.js;

/// <summary>
/// This unit contains all Google Ajax API wrapping classes.
/// 
/// For details, see http://code.google.com/apis/ajax/documentation/
/// </summary>
/// 
namespace monadsphere {

    public partial class google: JSVar {

        protected static google instance = new google();

        protected google() {
            name = "google";
        }

        /// <summary>
        /// Initialize Google API with a key.
        /// </summary>
        /// <param name="key"></param>
        public static void initLoader(string key, JSFunction callback) {
            JSContext.context.writeln("monadsphere.linkScript('http://www.google.com/jsapi?key=" + key + "&callback=" + callback + "')");
        }

        public static void load(JSString moduleName, JSString moduleVersion, OptionalSettings optionalSettings) {
            instance.callProcedure("load", moduleName, moduleVersion, optionalSettings);
        }
    }

    public class OptionalSettings: JSObject {

        public JSFunction callback {
            set {
                setProperty("callback", value);
            }
        }

        public JSString language {
            set {
                setProperty("language", value);
            }
        }

        public JSBoolean nocss {
            set {
                setProperty("nocss", value);
            }
        }

        public JSString packages {
            set {
                setProperty("packages", value);
            }
        }

        public JSString base_domain {
            set {
                setProperty("base_domain", value);
            }
        }

        public JSVar other_params {
            set {
                setProperty("other_params", value);
            }
        }
    }
}